package com.liunian.subject.application.dto;

import com.liunian.subject.domain.entity.SubjectCategoryBO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

@Data
@ApiModel(value = "题目类别DTO")
public class SubjectCategoryDTO implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "主键id")
    private Long id;

    @ApiModelProperty(value = "分类名称")
    private String categoryName;

    @ApiModelProperty(value = "分类类别")
    private Integer categoryType;

    @ApiModelProperty(value = "图标链接")
    private String imageUrl;

    @ApiModelProperty(value = "父级id")
    private Long parentId;

    public SubjectCategoryBO subjectCategoryDTOtoBO() {
        SubjectCategoryBO bo = new SubjectCategoryBO();
        bo.setId(this.id);
        bo.setCategoryName(this.categoryName);
        bo.setCategoryType(this.categoryType);
        bo.setImageUrl(this.imageUrl);
        bo.setParentId(this.getParentId());
        return bo;
    }

    public SubjectCategoryDTO subjectCategoryBOToDTO(SubjectCategoryBO bo) {
        SubjectCategoryDTO dto = new SubjectCategoryDTO();
        dto.setId(bo.getId());
        dto.setCategoryName(bo.getCategoryName());
        dto.setCategoryType(bo.getCategoryType());
        dto.setImageUrl(bo.getImageUrl());
        dto.setParentId(bo.getParentId());
        return dto;
    }

}